//=============================================================================
// Plasma Sword
//=============================================================================
class Tazer extends Weapon
            config(user);

#EXEC OBJ LOAD FILE=InterfaceContent.utx

var(FirstPerson) float NewEffectOffset;

function float GetAIRating()
{
 local Bot B;
 local float EnemyDist;
 local vector EnemyDir;

 B = Bot(Instigator.Controller);
 if ( B == None )
  return AIRating;

 if ( B.Enemy == None )
 {
  if ( (B.Target != None) && VSize(B.Target.Location - B.Pawn.Location) > 3500 )
   return 0.2;
  return AIRating;
 }

  if (EnyaraPlayerController(B.Enemy.Controller).bInvulnToStun)
    return 0.2;

 // if retreating, favor this weapon
 EnemyDir = B.Enemy.Location - Instigator.Location;
 EnemyDist = VSize(EnemyDir);
 if ( EnemyDist > 1500 )
  return 0.1;
 if ( -1 * EnemyDir.Z > EnemyDist )
  return AIRating + 0.1;
 if ( EnemyDist < 500 )
  return AIRating + 0.4;

 return AIRating;
}

/* BestMode()
choose between regular or alt-fire
*/
function byte BestMode()
{
  local Bot B;
  local float EnemyDist;
  local vector EnemyDir;

  B = Bot(Instigator.Controller);

  if (B.Enemy.IsHumanControlled() && EnyaraPawn(B.Enemy) != none) {
    if (EnyaraPlayerController(B.Enemy.Controller).GetStateName() == 'Stunned') {
      //Level.GetLocalPlayerController().clientMessage("Using secondary fire");
      return 1;
    }
  }

  return 0;
}

function float SuggestAttackStyle()
{
 local Bot B;
 local float EnemyDist;

 B = Bot(Instigator.Controller);
 if ( (B == None) || (B.Enemy == None) )
  return 0.4;

  if (B.Enemy.IsHumanControlled() && EnyaraPawn(B.Enemy) != none) {
    if (EnyaraPlayerController(B.Enemy.Controller).GetStateName() == 'Stunned') {
      //Level.GetLocalPlayerController().clientMessage("Back off", 'Critical');
      return -1.0;
    }
  }

 EnemyDist = VSize(B.Enemy.Location - Instigator.Location);

 if ( EnemyDist > 1000 )
  return 1.0;
 if ( EnemyDist > 1000 )
  return 0.4;

 return 1.0;
}

defaultproperties
{
     FireModeClass(0)=Class'Enyara.TazerFire'
     FireModeClass(1)=Class'Enyara.TazerAltFire'
     PutDownAnim="PutDown"
     IdleAnimRate=0.030000
     SelectSound=Sound'NewWeaponSounds.NewLinkSelect'
     SelectForce="SwitchToTazer"
     AIRating=0.680000
     CurrentRating=0.680000
     bMeleeWeapon=True
     bMatchWeapons=True
     OldMesh=SkeletalMesh'Weapons.LinkGun_1st'
     OldPickup="WeaponStaticMesh.LinkGunPickup"
     OldCenteredOffsetY=-12.000000
     OldPlayerViewOffset=(X=-2.000000,Y=-2.000000,Z=-3.000000)
     OldSmallViewOffset=(X=10.000000,Y=4.000000,Z=-9.000000)
     OldPlayerViewPivot=(Yaw=500)
     OldCenteredRoll=3000
     OldCenteredYaw=-300
     Description="Tazer - Don't taze me, bro!"
     EffectOffset=(X=100.000000,Y=25.000000,Z=-3.000000)
     DisplayFOV=60.000000
     Priority=7
     HudColor=(B=128,R=128)
     SmallViewOffset=(X=2.000000,Z=-1.500000)
     CenteredOffsetY=-5.000000
     CenteredRoll=3000
     CenteredYaw=-1000
     CustomCrosshair=10
     CustomCrossHairColor=(B=128,R=128)
     CustomCrossHairTextureName="Crosshairs.Hud.Crosshair_Bracket1"
     InventoryGroup=5
     PickupClass=Class'Enyara.TazerPickup'
     PlayerViewOffset=(X=-5.000000,Y=-3.000000)
     PlayerViewPivot=(Yaw=500)
     BobDamping=1.575000
     AttachmentClass=Class'XWeapons.LinkAttachment'
     IconMaterial=Texture'HUDContent.Generic.HUD'
     IconCoords=(X1=169,Y1=78,X2=244,Y2=124)
     ItemName="Tazer"
     Mesh=SkeletalMesh'NewWeapons2004.FatLinkGun'
     bCanThrow=false;
}
